package cate.game.role.res.adverttisement.msg;

import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBWatchAdvertisement;
import cate.game.role.res.adverttisement.RoleWatchAdvertisement;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "领取奖励 的 请求")
public class TakeAdvRewardReq implements MsgInput {
    @NoteField("奖励类型：1-快速作战广告奖励，2-在线时长奖励，3-高抽奖励")
    public int type;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<RoleWatchAdvertisement> result = cc.getRole().getRes().watchAdvertisement.takeReward(type);
        if (result.ok()) {
            result.data.noticeUpdate();
        }else {
            game.notice.message(cc.getRole(), result);
        }

    }

    @Override
    public MsgConfig conf() {
        return MsgIdBWatchAdvertisement.TAKE_REWARD_REQ;
    }
}
